<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <form action="http://localhost:3000/api/submit" method="post">
      <input type="text" name="name" placeholder="请输入姓名" />
      <input type="text" name="age" placeholder="请输入年龄" />
      <div class="upload-box">
        <input type="file" name="avatar" id="avatar" accept="image/*" />
        <div>
          <label for="avatar">上传头像</label>
          <b>+</b>
        </div>
        <img src="" alt="" id="preview" style="display: none" />
      </div>
      <button type="submit">提交</button>
    </form>
    <script src="./index.js"></script>
    <style>
      .upload-box {
        position: relative;
        width: 100px;
        height: 100px;
        border: 1px solid #ccc;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
      }
      .upload-box input {
        position: absolute;
        width: 100%;
        height: 100%;
        opacity: 0;
        z-index: 5;
      }
      .upload-box img {
        width: 100%;
        height: 100%;
      }
      .upload-box b {
        position: absolute;
        font-size: 28px;
        top: 50%;
      }
    </style>
  </body>
</html>
